﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CodeDynamiksCtl;
using MESCodeFile;

namespace mes_tublay
{
    public partial class frmNotificationViewer : Form
    {
        bool showAdvance = false;
        Notification ntfy;
        public frmNotificationViewer()
        {
            InitializeComponent();
            InitializeFrameSliderForm();
        }
        private void InitializeForm()
        {
            DoEvents();
        }
        public ImageList ImageList;
        public void LoadNotification(Notification n)
        {
            ntfy = n;
            lblMsg.Text = ntfy.Message;
            lblID.Text = ntfy.MetaData[0].ToString();
            lblStamp.Text = ntfy.MetaData[1].ToString();
            string tmp = string.Format("{0} by {1}\r\n",ntfy.MetaData[2], ntfy.MetaData[3]) ;
            tmp += "Meta Data:\r\n";
            string[] mta = ntfy.MetaData[4].ToString().Split('|');
            for (int i = 0; i < mta.Length; i++)
            {
                tmp += mta[i];
                if (i < mta.Length - 1) tmp += "\r\n";
            }
            lblMeta.Text = tmp;
            //int key = Common.Notify.NotificationSys.ImageList.Images.IndexOfKey(ntfy.ImageKey);
            imgNotify.Image = ImageList.Images[ntfy.ImageKey];
        }
        void DoEvents()
        {
            btnAdvance.Click += new EventHandler(delegate
            {
                if (!showAdvance)
                {
                    btnAdvance.Text = "Hide Advance";
                    lblMeta.Visible = true;
                    showAdvance = true;
                }
                else
                {
                    btnAdvance.Text = "Show Advance";
                    lblMeta.Visible = false;
                    showAdvance = false;
                }
            });
        }
    }
}
